home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / create6r / namenip.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-05-23  |  3.6 KB  |  121 lines

  1. VERSION 5.00
  2. Begin VB.Form NameNIP 
  3.    AutoRedraw      =   -1  'True
  4.    BackColor       =   &H00FFFFFF&
  5.    Caption         =   "Essential Information"
  6.    ClientHeight    =   2355
  7.    ClientLeft      =   60
  8.    ClientTop       =   345
  9.    ClientWidth     =   4035
  10.    Icon            =   "NameNIP.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   157
  13.    ScaleMode       =   3  'Pixel
  14.    ScaleWidth      =   269
  15.    StartUpPosition =   3  'Windows Default
  16.    Begin VB.CommandButton Command1 
  17.       Caption         =   "Ok"
  18.       Height          =   375
  19.       Left            =   2760
  20.       TabIndex        =   2
  21.       Top             =   1800
  22.       Width           =   1095
  23.    End
  24.    Begin VB.TextBox Text2 
  25.       BackColor       =   &H80000002&
  26.       ForeColor       =   &H80000009&
  27.       Height          =   375
  28.       Left            =   150
  29.       TabIndex        =   1
  30.       Top             =   1200
  31.       Width           =   3735
  32.    End
  33.    Begin VB.TextBox Text1 
  34.       BackColor       =   &H80000002&
  35.       ForeColor       =   &H80000009&
  36.       Height          =   375
  37.       Left            =   150
  38.       TabIndex        =   0
  39.       Top             =   480
  40.       Width           =   3735
  41.    End
  42.    Begin VB.Label Label1 
  43.       BackStyle       =   0  'Transparent
  44.       Caption         =   "Nick Name"
  45.       Height          =   255
  46.       Index           =   1
  47.       Left            =   150
  48.       TabIndex        =   4
  49.       Top             =   930
  50.       Width           =   2295
  51.    End
  52.    Begin VB.Label Label1 
  53.       BackStyle       =   0  'Transparent
  54.       Caption         =   "Computer Name or IP"
  55.       Height          =   255
  56.       Index           =   0
  57.       Left            =   150
  58.       TabIndex        =   3
  59.       Top             =   150
  60.       Width           =   2295
  61.    End
  62. Attribute VB_Name = "NameNIP"
  63. Attribute VB_GlobalNameSpace = False
  64. Attribute VB_Creatable = False
  65. Attribute VB_PredeclaredId = True
  66. Attribute VB_Exposed = False
  67. Private Sub Command1_Click()
  68. waitforplayer = False
  69. HostName = Text1.Text
  70. TryConnect = False
  71. NickName = Text2.Text
  72. frmChess.Label3.Caption = NickName & " Vs "
  73. If PlayOffline Then
  74. Unload Me
  75. VisitorName = Text1.Text
  76. NickName = Text2.Text
  77. frmChess.InitGame
  78.  If JoueurHote Then
  79.   If frmChess.SockClient.State <> 7 Then frmChess.SockClient.Close
  80.   frmChess.SockClient.Protocol = sckTCPProtocol
  81.   frmChess.SockClient.LocalPort = 1004
  82.   frmChess.SockClient.Listen
  83.   'frmInfoG.Label1.Caption = "Wait For Other Player"
  84.   waitforplayer = True
  85.   Unload Me
  86.   frmtryConnect.GetinitWaitting
  87.   frmtryConnect.Show 1
  88.   Exit Sub
  89.   'frmInfoG.Label1.Caption = "Try to Connect"
  90.   Unload Me
  91.   Connect
  92.   frmtryConnect.GetinitWaitting
  93.   frmtryConnect.Show 1
  94. End If
  95. End If
  96. End Sub
  97. Public Sub Connect()
  98. 'On Error Resume Next
  99.   TryConnect = True
  100.   frmChess.SockClient.Close
  101.   frmChess.SockClient.Protocol = sckTCPProtocol
  102.   frmChess.SockClient.RemotePort = 1004
  103.   frmChess.SockClient.RemoteHost = HostName
  104.   frmChess.SockClient.Connect
  105. End Sub
  106. Private Sub Form_Load()
  107. OutSquare 0, 0, ScaleWidth - 1, ScaleHeight, Me
  108. InSquare Text1.Left, Text1.Top, Text1.Width - 1, Text1.Height, Me
  109. InSquare Text2.Left, Text2.Top, Text2.Width - 1, Text2.Height, Me
  110. InSquare Command1.Left, Command1.Top, Command1.Width - 1, Command1.Height, Me
  111. If PlayOffline Then
  112.  Label1(0).Caption = "Nickname Visitor"
  113.  HostName = "Visitor"
  114.  Label1(0).Caption = "Computer Name or IP"
  115. End If
  116. Text1.Text = HostName
  117. Text2.Text = NickName
  118. Left = frmChess.Left + ((frmChess.Width - Width) / 2)
  119. Top = frmChess.Top + ((frmChess.Height - Height) / 2)
  120. End Sub
  121.